package item;

import loadsave.Memento;
import loadsave.loadsaveobject.LoadSaveObject;
import effects.Effect;

public class OneShotItem extends InteractiveItem {

    public OneShotItem( String name, Effect effect ) {
        super(name, effect);
    }
    
    public OneShotItem( String name, Requirements requirements ) {
        super(name, requirements);
    }
    
    public void accept( visitors.ItemVisitor iv ) {
        iv.visitOneShotItem(this);
    }
    
    /**
     * overridden from superclas to that you can walk on oneshots
     */
    public boolean canBeWalkedOn() {
        return true;
    }
 
    @Override
    public Memento getMemento() {
        return new Memento() {

            @Override
            public LoadSaveObject getState() {
                LoadSaveObject lso = OneShotItem.super.getMemento().getState();
                lso.setType("OneShotItem");
                return lso;
            }

            @Override
            public void restoreState(LoadSaveObject lso) {
                OneShotItem.super.getMemento().restoreState(lso);
            }
            
        };
    }
    
    public OneShotItem() { }
    
    @Override
	public OneShotItem clone() {
		OneShotItem toReturn = new OneShotItem();
		toReturn.getMemento().restoreState(this.getMemento().getState());
		return toReturn;
	}
    
    
}
